<?php

namespace redis;

use think\Config;

class Redis
{
    private static $instance = null;

    private function __construct()
    {
        // Private constructor to prevent direct instantiation
    }

    public static function getInstance()
    {
        if (self::$instance === null) {
            self::$instance = new \Redis();
            self::$instance->connect(config('redis.host'),config('redis.port'));
            self::$instance->auth(config('redis.auth'));
            self::$instance->select(1);
        }
        return self::$instance;
    }
}
